<!-- mate start -->
<?php $this->load->view('assists/mate.php') ?>
<!-- mate end -->
<link rel="stylesheet" href="<?=base_url('static/index/css/project_content_list.css')?>" />
<title>众创项目内容列表</title>
<!-- header strat -->
<?php $this->load->view('assists/header.php') ?>
<!-- header end -->
    
    <div id="project">
    	<div class="project_title">
        	<h2><?=$project_title?></h2>
        </div>
    </div>
    
    
    <div id="project_content_list">
    	<div class="project_content_list">
        	<ul class="project_content_list_ul">
        	
        		<?php foreach ($project_content_list as $row): ?>
            	<li class="clearfix">
                	<div class="project_content_list_ul_left">
                    	<p>
                    	<?php if($row['type']==0){ ?>
                        	<!--作为这个世界上最流行的编程语言之一的合作设计者，我经常遇到一种令人非常沮丧的行为( Python 社区和其它领域中都存在)就是社区中有影响力的人尝试去在其它开源社区中灌输对于”缺失“的恐惧感，并以此驱动别人对本社区做出贡献（我自己偶尔也会做出这样不当的行为，当别人掉进这个陷阱时我也更容易觉察出来）。-->
                        	<?=$row['content']?>
                        <?php }else{?>
                        	<img src="<?=base_url($row['content'])?>">
                        <?php } ?>
                        </p>
                        <div class="project_content_list_ul_left_content clearfix">
                        	<a href="<?=site_url('Project_content_comment/add/'.$row['pcid'])?>" class="project_content_comment">评论</a>
                        </div>
                    </div>
                    <?php if(!empty($row['comment'])){ ?>
                    <div class="project_content_list_ul_right">
                    	<ul class="project_content_user_ul">
                    		<?php foreach ($row['comment'] as $value): ?>
                        	<li class="clearfix">
                            	<div class="project_content_user_logo">
                                	<a href="<?=site_url('User/index/'.$value['user_id'])?>"><img src="<?=base_url('static/index/images/user_logo.jpg')?>" /></a>
                                </div>
                                <div class="project_content_user_content">
                                	
                                    　　					<?=$value['content']?>
                                   
                                </div>
                            </li>
                            <?php endforeach; ?>
                        </ul>
                    </div>
                    <?php } ?>
                    <div class="tool">
                    	<ul class="clearfix">
                        	<li><a href="#"><i class="up"></i></a></li>
                            <li><a href="#"><i class="down"></i></a></li>
                        </ul>
                    </div>
                </li>
                <?php endforeach; ?>
            </ul>
        </div>
        
        <div id="project_content_text_box">
        </div>
        <div id="project_content_img_box">
        	<div class="project_content_img_box">
            	<div class="img-con-tit clearfix">
            		<div class="img-con-tit-left"><span class="fz16">添加图片</span></div>
            		<div class="img-con-tit-right"><input type="button" value="删除" class="img_del_btn" onclick="delete_img(this)"></div>
            	</div>
            	<div class="img_content">
		            <div id="altContent">
						<h1>美图秀秀</h1>
					</div>
				</div>
			</div>
        </div>
        <?php if(isset($_SESSION['username'])&&($username==$this->session->userdata('username'))){ ?>
        <div class="add_project_content">
            <div class="add_project_content_type clearfix">
            	<div class="add_project_content_text" onclick="addBlock('text')">
                	<i class="add_text"></i>添加文本
                </div>
                <div class="add_project_content_img" onclick="addBlock('img')">
                	<i class="add_img"></i>添加图片
                </div>
            </div>
        </div>
        <?php } ?>
    </div>
    
    
    
    
    <div id="page">
    	<div class="page_content clearfix">
        	共 <?=$this->paging->page_count?> 条记录
			<div class="page_content_left">
            	<!--<ul>
                	<li><a href="#">首页</a></li>
                    <li class="am-disabled"><a href="#">上一页</a></li>
                    <li class="am-active"><a href="#">1</a></li>
                    <li><a href="#">2</a></li>
                    <li><a href="#">下一页</a></li>
                    <li><a href="#">尾页</a></li>
                </ul>-->
                <?php $this->paging->create();?>
            </div>
        </div>
    </div>
    
    <!-- footer start -->
   	<?php $this->load->view('assists/footer.php') ?>
   	<!-- footer end -->
    
    <script type="text/javascript" src="<?=base_url('static/index/js/project_content.js')?>"></script>
    <script src="http://open.web.meitu.com/sources/xiuxiu.js" type="text/javascript"></script>
	<script type="text/javascript">
	window.onload=function(){
	       /*第1个参数是加载编辑器div容器，第2个参数是编辑器类型，第3个参数是div容器宽，第4个参数是div容器高*/
		xiuxiu.embedSWF("altContent",2,"100%","100%");
	       //修改为您自己的图片上传接口
		xiuxiu.setUploadURL("<?=site_url('Project_content/uploadImage/'.$pid)?>");
	        xiuxiu.setUploadType(2);
	        xiuxiu.setUploadDataFieldName("Filedata");
		xiuxiu.onInit = function ()
		{
			xiuxiu.loadPhoto("http://open.web.meitu.com/sources/images/1.jpg");
		}	
		xiuxiu.onUploadResponse = function (data)
		{
			//alert("上传响应" + data);  可以开启调试
			//alert(data);
			//console.log(data);
			//alert("nihao");
			location.reload();
		}
	}
	function addBlock(category){
		var content_box_object = $("#project_content_text_box");
		if(category=="text"){
			var string ='<div class="project_content_text_box"><form action="<?=site_url('Project_content/addText')?>" method="post"><input type="hidden" name="pid" value="<?=$pid?>" /><div class="text-con-tit clearfix"><div class="text-con-tit-left"><span class="fz16">添加文本</span></div><div class="text-con-tit-right"><input type="button" value="删除" onclick="delete_content(this)" class="del_btn"><input type="submit" class="text-con-tit-right-btn textSave" value="保存" /></div></div><div class="text-con-con"><textarea name="content" class="text-con-con-box">正文</textarea></div></form></div>';
			content_box_object.append(string);
		}else if(category=="img"){
			//var string ='<div class="project_content_img_box"><div class="img-con-tit clearfix"><div class="img-con-tit-left"><span class="fz16">添加文本</span></div><div class="img-con-tit-right"><input type="button" value="删除" class="img_del_btn"></div></div><div class="img_content"><div id="altContent"><h1>美图秀秀</h1></div></div></div>';
			//content_box_object.append(string);
			$(".project_content_img_box").css("display","block");
		}
	}
	</script>
</body>
</html>